﻿//var data = new RMS.CCSV2JSON(dataMenu).toJson();
var Xtreedata = {
    menuitems: [
        {
            ID: 1, Code: 'A', Name: 'Home', Description: '', ParentID: null, LinkURL: '#Home', _level: 0, FaCss: ' fa-home',
            menuitems: [
                {
                    ID: 11, Code: 'A1', Name: 'Home 1', Description: '', ParentID: null, LinkURL: '#Home', _level: 1,
                    menuitems: [
                        {
                            ID: 111, Code: 'A11', Name: 'Home 11', Description: '', ParentID: null, LinkURL: '#Home11', _level: 2
                        },
                        {
                            ID: 112, Code: 'A12', Name: 'Home 12', Description: '', ParentID: null, LinkURL: '#Home12', _level: 2
                        },
                        {
                            ID: 113, Code: 'A13', Name: 'Home 13', Description: '', ParentID: null, LinkURL: '#Home13', _level: 2
                        }
                    ]
                },
                {
                    ID: 12, Code: 'A2', Name: 'Home 2', Description: '', ParentID: null, LinkURL: '#Home', _level: 1,
                    menuitems: [
                        {
                            ID: 121, Code: 'A21', Name: 'Home 21', Description: '', ParentID: null, LinkURL: '#Home21', _level: 2
                        },
                        {
                            ID: 122, Code: 'A22', Name: 'Home 22', Description: '', ParentID: null, LinkURL: '#Home22', _level: 2
                        },
                        {
                            ID: 123, Code: 'A23', Name: 'Home 23', Description: '', ParentID: null, LinkURL: '#Home23', _level: 2
                        }
                    ]

                }
            ]
        },
        {
            ID: 2, Code: 'B', Name: 'Products', Description: '', ParentID: null, LinkURL: '#Products', _level: 0, FaCss: ' fa-shopping-cart',
            menuitems: [
                {
                    ID: 21, Code: 'B21', Name: 'Products 1', Description: '', ParentID: null, LinkURL: '#Products1', _level: 1
                },
                {
                    ID: 22, Code: 'B22', Name: 'Products 2', Description: '', ParentID: null, LinkURL: '#Products1', _level: 1,
                    menuitems: [
                        {
                            ID: 221, Code: 'B21', Name: 'Products 21', Description: '', ParentID: null, LinkURL: '#Support21', _level: 2
                        },
                        {
                            ID: 222, Code: 'B22', Name: 'Separator', Description: '', ParentID: null, LinkURL: '', Type: 'separator22', _level: 2
                        },
                        {
                            ID: 223, Code: 'B23', Name: 'Products 22', Description: '', ParentID: null, LinkURL: '#Support23', _level: 2
                        },
                        {
                            ID: 224, Code: 'B24', Name: 'Products 23', Description: '', ParentID: null, LinkURL: '#Support24', _level: 2
                        }
                    ]
                },
                {
                    ID: 23, Code: 'B23', Name: 'Separator', Description: '', ParentID: null, LinkURL: '', Type: 'separator', _level: 1
                },
                {
                    ID: 24, Code: 'B24', Name: 'Products 3', Description: '', ParentID: null, LinkURL: '#Products3', _level: 1
                },
                {
                    ID: 25, Code: 'B25', Name: 'Products 4', Description: '', ParentID: null, LinkURL: '#Products4', _level: 1
                }
            ]
        },
        {
            ID: 3, Code: 'C', Name: 'Support', Description: '', ParentID: null, LinkURL: '#Support', _level: 0, FaCss: ' fa-life-ring',
            menuitems: [
                {
                    ID: 31, Code: 'C1', Name: 'Support 1', Description: '', ParentID: null, LinkURL: '#Support1', _level: 1
                },
                {
                    ID: 32, Code: 'C2', Name: 'Support 2', Description: '', ParentID: null, LinkURL: '#Support2', _level: 1
                },
                {
                    ID: 33, Code: 'C3', Name: 'Support 3', Description: '', ParentID: null, LinkURL: '#Support3', _level: 1
                }
            ]
        },
        {
            ID: 4, Code: 'D', Name: 'Communities', Description: '', ParentID: null, LinkURL: '#Communities', _level: 0, FaCss: ' fa-weixin',
            menuitems: [
                {
                    ID: 41, Code: 'D41', Name: 'Communities 1', Description: '', ParentID: null, LinkURL: '#Communities1', _level: 1
                }
            ]
        },
        {
            ID: 5, Code: 'E', Name: 'About', Description: '', ParentID: null, LinkURL: '#About', _level: 0, FaCss: ' fa-star',
        }
    ]
};

var toolbar_data = {
    buttons: [
        {
            Code: 'tiEdit',
            Name: '',
            Title: 'Click to edit',
            FaCss: 'fa-edit',
            Hotkey: 'Ctrl+E',
            Callback: 'alert("edit: say hi")'
        },
        {
            Code: '',
        },
        {
            Code: 'tiNew',
            Name: '',
            Title: 'Click to new item',
            FaCss: 'fa-file-o',
            Hotkey: 'Ctrl+N',
            Callback: 'alert("new: say hi")'
        },
        {
            Code: 'tiOpen',
            Name: '',
            Title: 'Click to open item',
            FaCss: 'fa-folder-open-o',
            Hotkey: 'Ctrl+O',
            Callback: 'alert("open: say hi")'
        },
        {
            Code: 'tiSave',
            Name: '',
            Title: 'Click to save',
            FaCss: 'fa-save',
            Hotkey: 'Ctrl+S',
            Callback: 'alert("save: say hi")'
        },
        {
            Code: '',
        },
        {
            Code: 'tiCut',
            Name: '',
            Title: 'Click to cut selection',
            FaCss: 'fa-cut',
            Hotkey: 'Ctrl+X',
            Disable: true,
            Callback: 'alert("cut: say hi")'
        },
        {
            Code: 'tiCopy',
            Name: '',
            Title: 'Click to copy selection',
            FaCss: 'fa-copy',
            Hotkey: 'Ctrl+C',
            Disable: true,
            Callback: 'alert("copy: say hi")'
        },
        {
            Code: 'tiPaste',
            Name: '',
            Title: 'Click to paste selection',
            FaCss: 'fa-paste',
            Hotkey: 'Ctrl+V',
            Disable: true,
            Callback: 'alert("paste: say hi")'
        },
        {
            Code: '',
        },
        {
            Code: 'itemSearch',
            Name: 'Search',
            Title: 'Search',
            FaCss: 'fa-search',
            Callback: 'alert("search: say hi")'
        },
        {
            Code: 'itemFilter',
            Name: 'Filter',
            Title: 'Filter data',
            FaCss: 'fa-filter',
            Callback: 'alert("filter: say hi")'
        },
        {
            Code: 'item7',
            Name: 'Print',
            Title: 'Print',
            FaCss: 'fa-print',
            Hotkey: 'Ctrl+P',
            Callback: 'alert("print: say hi")'
        }
    ]
};

var toolbar_system_data = {
    buttons: [
        {
            Code: 'item7',
            Name: '',
            Align: 'right',
            Title: 'Exit & close application',
            FaCss: 'fa-sign-out',
            Callback: ''
        },
        {
            Code: 'item7',
            Name: '',
            Align: 'right',
            Title: 'Configuration Setting',
            FaCss: 'fa-cog',
            Callback: ''
        },
        {
            Code: '',
            Align: 'right',
        },
        {
            Code: 'item7',
            Name: '(5)',
            Align: 'right',
            Title: 'Message(s)',
            FaCss: 'fa-envelope-o',
            Callback: ''
        },
        {
            Code: 'item0',
            Name: 'Hi, Đỗ Lâm Thiên',
            Align: 'right',
            Title: 'User Information',
            FaCss: 'fa-user',
            Callback: ''
        }
    ]
}
var front = {
    f: {
        showinfo: function (el) {
            var data = $(el).attr('item-data');
            if (!data) {
                console.log('front.showinfo(data) - data is undefined');
                return;
            }

            $('#main_header').html(data);
            console.log('front.showinfo', data);
        },
        getItemData: function (item) {
            var ret = {
                ID: item.ID
            };
            return JSON.stringify(ret);
        }
    }
}

//=============================================================================================
var treedataArr = [
    { ID: 1, Code: 'A', Name: 'Home', Description: '', ParentID: null, LinkURL: '#Home', _TmpLevel: 0, FaCss: ' fa-home' },
    { ID: 11, Code: 'A1', Name: 'Home 1', Description: '', ParentID: 1, LinkURL: '#Home', _TmpLevel: 1 },
    { ID: 11, Code: 'A1', Name: 'Home 1', Description: '', ParentID: 1, LinkURL: '#Home', _TmpLevel: 1 },
    { ID: 111, Code: 'A11', Name: 'Home 11', Description: '', ParentID: 11, LinkURL: '#Home11', _TmpLevel: 2 },
    { ID: 112, Code: 'A12', Name: 'Home 12', Description: '', ParentID: 11, LinkURL: '#Home12', _TmpLevel: 2 },
    { ID: 113, Code: 'A13', Name: 'Home 13', Description: '', ParentID: 11, LinkURL: '#Home13', _TmpLevel: 2 },
    { ID: 12, Code: 'A2', Name: 'Home 2', Description: '', ParentID: 1, LinkURL: '#Home', _TmpLevel: 1 },
    { ID: 121, Code: 'A21', Name: 'Home 21', Description: '', ParentID: 12, LinkURL: '#Home21', _TmpLevel: 2 },
    { ID: 122, Code: 'A22', Name: 'Home 22', Description: '', ParentID: 12, LinkURL: '#Home22', _TmpLevel: 2 },
    { ID: 123, Code: 'A23', Name: 'Home 23', Description: '', ParentID: 12, LinkURL: '#Home23', _TmpLevel: 2 },
    { ID: 2, Code: 'B', Name: 'Products', Description: '', ParentID: null, LinkURL: '#Products', _TmpLevel: 0, FaCss: ' fa-shopping-cart' },
    { ID: 21, Code: 'B21', Name: 'Products 1', Description: '', ParentID: 2, LinkURL: '#Products1', _TmpLevel: 1 },
    { ID: 22, Code: 'B22', Name: 'Products 2', Description: '', ParentID: 2, LinkURL: '#Products1', _TmpLevel: 1 },
    { ID: 221, Code: 'B21', Name: 'Products 21', Description: '', ParentID: 22, LinkURL: '#Support21', _TmpLevel: 2 },
    { ID: 222, Code: 'B22', Name: 'Separator', Description: '', ParentID: 22, LinkURL: '', Type: 'separator22', _TmpLevel: 2 },
    { ID: 223, Code: 'B23', Name: 'Products 22', Description: '', ParentID: 22, LinkURL: '#Support23', _TmpLevel: 2 },
    { ID: 224, Code: 'B24', Name: 'Products 23', Description: '', ParentID: 22, LinkURL: '#Support24', _TmpLevel: 2 },
    { ID: 23, Code: 'B23', Name: 'Separator', Description: '', ParentID: 2, LinkURL: '', Type: 'separator', _TmpLevel: 1 },
    { ID: 24, Code: 'B24', Name: 'Products 3', Description: '', ParentID: 2, LinkURL: '#Products3', _TmpLevel: 1 },
    { ID: 25, Code: 'B25', Name: 'Products 4', Description: '', ParentID: 2, LinkURL: '#Products4', _TmpLevel: 1 },
    { ID: 3, Code: 'C', Name: 'Support', Description: '', ParentID: null, LinkURL: '#Support', _TmpLevel: 0, FaCss: ' fa-life-ring' },
    { ID: 31, Code: 'C1', Name: 'Support 1', Description: '', ParentID: 3, LinkURL: '#Support1', _TmpLevel: 1 },
    { ID: 32, Code: 'C2', Name: 'Support 2', Description: '', ParentID: 3, LinkURL: '#Support2', _TmpLevel: 1 },
    { ID: 33, Code: 'C3', Name: 'Support 3', Description: '', ParentID: 3, LinkURL: '#Support3', _TmpLevel: 1 },
    { ID: 4, Code: 'D', Name: 'Communities', Description: '', ParentID: null, LinkURL: '#Communities', _TmpLevel: 0, FaCss: ' fa-weixin' },
    { ID: 41, Code: 'D41', Name: 'Communities 1', Description: '', ParentID: 4, LinkURL: '#Communities1', _TmpLevel: 1 },
    { ID: 5, Code: 'E', Name: 'About', Description: '', ParentID: null, LinkURL: '#About', _TmpLevel: 0, FaCss: ' fa-star' }
];
